# coding=utf-8
'''
@author: guichaochao

@desc:生成测试报告路径及信息

'''
import time
import HTMLTestRunner
import os


def report_info():
    # result = 'D:\\PycharmProjects\\knowbox1\\result\\'
    # now = time.strftime('%Y-%m-%d-%H_%M_%S', time.localtime(time.time()))
    # day = time.strftime('%Y-%m-%d', time.localtime(time.time()))
    # report_path = result + day
    # if os.path.exists(report_path):
    #     reportFile = report_path + now + "_result.html"
    #     testReport = file(reportFile, 'wb')
    #     runner = HTMLTestRunner.HTMLTestRunner(
    #         stream=testReport,
    #         title=u'自动化测试报告',
    #         description=u'用例执行情况：')
    #     return report_path, testReport, runner
    # else:
    #     os.mkdir(report_path)
    #     reportFile = report_path + now + "_result.html"
    #     testReport = file(reportFile, 'wb')
    #     runner = HTMLTestRunner.HTMLTestRunner(
    #         stream=testReport,
    #         title=u'自动化测试报告',
    #         description=u'用例执行情况：')
    #     return report_path, testReport, runner
    now = time.strftime("%Y-%m-%d%H%M%S")
    report_path = 'D:\\PycharmProjects\\knowbox1\\result\\'
    reportFile = report_path + now + 'result.html'
    testReport = file(reportFile, 'wb')
    runner = HTMLTestRunner.HTMLTestRunner(
        stream=testReport,
        title=u'作业盒子小学学生端测试报告',
        description=u'用例执行情况：')
    return report_path, testReport, runner


